<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var x = 10

    function fn() {
        console.log(x)
    }

    function show(f) {
        var x = 20
        (function () {
            f() //10，而不是20
        })()
    }

    show(fn)
</script>
</body>
</html>